"""
urllib parse: 传参之前需要先把参数编码
"""
from urllib import parse

params = {'id': 1, 'name': 'melo春龙'}

mage_url = 'http://www.magedu.com/python'

# url编码
url = '{}?{}'.format(mage_url, parse.urlencode(params))
print(url)
# url解码
print(parse.unquote(url))
